home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_10 / phillip2 / patch.c < prev    next >
Text File  |  1994-03-02  |  5KB  |  164 lines

  1.  
  2.         case 24:  /* warp operations */
  3.          printf("\nCIPS> Enter input image name\n");
  4.          get_image_name(name);
  5.          printf("\nCIPS> Enter output image name\n");
  6.          get_image_name(name2);
  7.          get_parameters(&il, &ie, &ll, &le);
  8.          get_warp_options(method, &bilinear, 
  9.                  &x_control, &y_control,
  10.                  &x1, &y1, &x2, &y2, 
  11.                  &x3, &y3, &x4, &y4);
  12.          if(strncmp(method, "warp", 3) == 0)
  13.             warp(name, name2, 
  14.               the_image, out_image,
  15.                  il, ie, ll, le,
  16.                  x_control, y_control,
  17.                  bilinear);
  18.          if(strncmp(method, "object-warp", 3) == 0)
  19.             object_warp(name, name2, 
  20.                the_image, out_image,
  21.                   il, ie, ll, le, 
  22.                   x1, y1, x2, y2, 
  23.                   x3, y3, x4, y4,
  24.                   bilinear);
  25.         break;
  26.  
  27.          .
  28.          .
  29.          .
  30.          .
  31.  
  32.    /*************************************************
  33.    *
  34.    *   show_menu(..
  35.    *
  36.    *   This function displays the CIPS main menu.
  37.    *
  38.    **************************************************/
  39.  
  40. show_menu()
  41. {
  42.  
  43.  printf(""
  44.  "\n\n\t\t\tWelcome to CIPS"
  45.  "\n\t\tThe C Image Processing System"
  46.  "\n\t\tDwayne Phillips 1990-1993"
  47.  "\nThese are your choices:"
  48.  "\n1.  Display image header               13. Image rotate & flip" 
  49.  "\n2.  Show image numbers                 14. Image scaling"    
  50.  "\n3.  Print image numbers                15. Create blank image" 
  51.  "\n4.  Display (EGA & VGA)                16. Image thresholding"
  52.  "\n5.  Display or print using halftoning  17. Image segmentation"
  53.  "\n6.  Print using dithering              18. Edge & gray segmentation"
  54.  "\n7.  Print or display histogram         19. Boolean operations"
  55.  "\n8.  Edge Detection                     20. Image overlay"
  56.  "\n9.  Edge Enhancement                   21. Shape operations"  
  57.  "\n10. Image filtering                    22. Texture operations"
  58.  "\n11. Image add & subtract               23. Geometry operations" 
  59.  "\n12 Image cut & paste                   24. Warp operations"
  60.  "\n30. Exit system\n"
  61.  "\nEnter choice __\b\b");
  62.  
  63. }  /* ends show_menu */
  64.  
  65.          .
  66.          .
  67.          .
  68.          .
  69.  
  70.      /*******************************************
  71.      *
  72.      *   get_warp_options(..
  73.      *
  74.      *   This routine interacts with the user
  75.      *   to obtain the parameters to call the
  76.      *   warping subroutines.
  77.      *
  78.      *******************************************/
  79.  
  80. get_warp_options(operation, bilinear, 
  81.                  x_control, y_control,
  82.                  x1, y1, x2, y2, 
  83.                  x3, y3, x4, y4)
  84.    char operation[];
  85.    int  *bilinear, 
  86.         *x_control, *y_control,
  87.         *x1, *y1, *x2, *y2, 
  88.         *x3, *y3, *x4, *y4;
  89. {
  90.    int not_finished, response;
  91.    not_finished = 1;
  92.    while(not_finished){
  93.  
  94.       printf("\nThe warp options are:");
  95.       printf("\n\t1. Operation is %s", operation);
  96.       printf("\n\t   (options are: warp   object-warp)");
  97.       printf("\n\t2. bilinear is %d", *bilinear);
  98.       printf("\n\t3. Control points: x=%d y=%d",
  99.              *x_control, *y_control);
  100.       printf("\n\t4. x1=%d y1=%d", *x1, *y1);
  101.       printf("\n\t5. x2=%d y2=%d", *x2, *y2);
  102.       printf("\n\t6. x3=%d y3=%d", *x3, *y3);
  103.       printf("\n\t7. x4=%d y4=%d", *x4, *y4);
  104.       printf("\n\t   Control points needed for warp");
  105.       printf("\n\t   Other points needed for object-warp");
  106.       printf("\n\nEnter choice (0 = no change) _\b");
  107.       get_integer(&response);
  108.  
  109.       if(response == 0)
  110.          not_finished = 0;
  111.  
  112.       if(response == 1){
  113.          printf("\nEnter operation:");
  114.          printf("\n\twarp   object-warp");
  115.          printf("\n");
  116.          gets(operation);
  117.       }  /* ends if 1 */
  118.  
  119.       if(response == 2){
  120.          printf("\nEnter bilinear:_\b");
  121.          get_integer(bilinear);
  122.       }  /* ends if 2 */
  123.  
  124.       if(response == 3){
  125.          printf("\nEnter the control points");
  126.          printf("\nEnter x:___\b\b\b");
  127.          get_integer(x_control);
  128.          printf("\nEnter y:___\b\b\b");
  129.          get_integer(y_control);
  130.       }  /* ends if 3 */
  131.  
  132.       if(response == 4){
  133.          printf("\nEnter x1:___\b\b\b");
  134.          get_integer(x1);
  135.          printf("\nEnter y1:___\b\b\b");
  136.          get_integer(y1);
  137.       }  /* ends if 4 */
  138.  
  139.       if(response == 5){
  140.          printf("\nEnter x2:___\b\b\b");
  141.          get_integer(x2);
  142.          printf("\nEnter y2:___\b\b\b");
  143.          get_integer(y2);
  144.       }  /* ends if 5 */
  145.  
  146.       if(response == 6){
  147.          printf("\nEnter x3:___\b\b\b");
  148.          get_integer(x3);
  149.          printf("\nEnter y3:___\b\b\b");
  150.          get_integer(y3);
  151.       }  /* ends if 6 */
  152.  
  153.       if(response == 7){
  154.          printf("\nEnter x4:___\b\b\b");
  155.          get_integer(x4);
  156.          printf("\nEnter y4:___\b\b\b");
  157.          get_integer(y4);
  158.       }  /* ends if 7 */
  159.  
  160.    }  /* ends while not_finished */
  161.  
  162.  
  163. }  /* ends get_warp_options */
  164.